/**
 * 
 */
package org.chungyan5.lib.android.gcal;

import android.database.Cursor;
import android.database.CursorWrapper;

/**
 * @author yan
 *
 */
public class GCalEventList extends CursorWrapper {

	public GCalEventList(Cursor cursor) {
		super(cursor);
	}

	/**
	 * already execute nextObject() before this method 
	 * @return a object of GCal
	 */
	public GCalEvent getRecord() {
		
		GCalEvent gCalEvent = new GCalEvent();
		
		gCalEvent.setId(this.getString( GoogleCalendarAPI.INSTANCES_ID_CURSOR_POS ));  
		gCalEvent.setTitle(this.getString( GoogleCalendarAPI.INSTANCES_EVENT_TITLE_CURSOR_POS ));
//gCalEvent.setTitle(this.getString( GoogleCalendarAPI.INSTANCES_EVENT_TITLE_CURSOR_POS ) + " " 
//+ this.getString( GoogleCalendarAPI.INSTANCES_CALENDAR_ID_CURSOR_POS ) + " " + this.getLong( GoogleCalendarAPI.INSTANCES_BEGIN_DATE_CURSOR_POS )
//+ " " + this.getLong( GoogleCalendarAPI.INSTANCES_END_DATE_CURSOR_POS )	);
		gCalEvent.setStartTime(this.getLong( GoogleCalendarAPI.INSTANCES_BEGIN_DATE_CURSOR_POS ));
		gCalEvent.setEndTime(this.getLong( GoogleCalendarAPI.INSTANCES_END_DATE_CURSOR_POS ));
		gCalEvent.setAllDay( this.getInt( GoogleCalendarAPI.INSTANCES_ALL_DAY_CURSOR_POS ) > 0 );
		gCalEvent.setDuration(this.getString( GoogleCalendarAPI.INSTANCES_DURATION_CURSOR_POS ));	// TODO return NULL, do not know the reason 
		
		return gCalEvent;
	}
}
